﻿<UserControl Name="UdListItemViewUserControl" x:Class="XERP.Client.WPF.UdListMaintenance.Views.UdListItemView"                             
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d" 
             d:DesignHeight="400" d:DesignWidth="400" Loaded="UserControl_Loaded" 
             >
    <Grid Style="{StaticResource BaseGrid}">
        <Grid.RowDefinitions>
            <RowDefinition Height="550*"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="422*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
            <TabControl Style="{StaticResource BaseTabControl}" Name="tabctrlMain" Grid.ColumnSpan="3">
                <TabItem  Style="{StaticResource BaseTabItem}" Name="tabDetail" Header="Detail">
                    <Grid Style="{StaticResource BaseGrid}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="657*"></RowDefinition>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="171"></ColumnDefinition>
                            <ColumnDefinition Width="246*"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <StackPanel Style="{StaticResource BaseStackPanel}"
                HorizontalAlignment="Stretch" VerticalAlignment="Top" 
                Orientation="Vertical" Grid.Row="1" Grid.Column="0" >
                            <TextBlock Style="{StaticResource BaseTextBlock}"
                    HorizontalAlignment="Right" VerticalAlignment="Top" Margin="8">ID:
                            </TextBlock>
                            <TextBlock Style="{StaticResource BaseTextBlock}"
                    HorizontalAlignment="Right" VerticalAlignment="Top" Margin="8">Description:
                            </TextBlock>
                        <TextBox Style="{StaticResource BaseTextBox}" 
                    Width="0" Height="0"  Name="ghost"  KeyboardNavigation.IsTabStop="False"/>
                    </StackPanel>
                        <StackPanel Style="{StaticResource BaseStackPanel}"
                Grid.Row="1" Grid.Column="1"
                HorizontalAlignment="Stretch" VerticalAlignment="top" 
                Orientation="Vertical" IsEnabled="{Binding AllowEditUdListItem}">
                        <TextBox Name="txtKey" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="5" Width="157"
                    Text="{Binding Path=SelectedUdListItem.UdListItemID, Mode=TwoWay, TargetNullValue=''}"
                    MaxLength= "{Binding UdListMaxFieldValueDictionary[Name]}" 
                    KeyboardNavigation.TabIndex="20"  BorderBrush="DimGray"
                                 >
                        </TextBox>
                        <TextBox Style="{StaticResource BaseTextBox}"
                    HorizontalAlignment="Left" VerticalAlignment="Top" Margin="5" Width="159"
                    Text="{Binding Path=SelectedUdListItem.Description, Mode=TwoWay}"
                    MaxLength= "{Binding UdListMaxFieldValueDictionary[Description]}" 
                    KeyboardNavigation.TabIndex="30" BorderBrush="DimGray"></TextBox>
                        </StackPanel>
                    </Grid>
                </TabItem>
                <TabItem Style="{StaticResource BaseTabItem}" Name="tabList" Header="List" 
        HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
        KeyboardNavigation.IsTabStop="False">
                    <Grid Style="{StaticResource BaseGrid}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="19*" />
                            <ColumnDefinition Width="60*" />
                        <ColumnDefinition Width="210*" />
                    </Grid.ColumnDefinitions>
                        <DataGrid Style="{StaticResource BaseDataGrid}" Name="dgMain" Grid.ColumnSpan="3" Grid.Column="2"
                        ItemsSource="{Binding SelectedUdList.UdListItems, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                        SelectedItem="{Binding SelectedUdListItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
                        SelectionMode="Extended" Initialized="dgMain_Initialized" 
                        PreviewKeyUp="dgMain_PreviewKeyUp" SelectionChanged="dgMain_SelectionChanged" 
                        PreviewKeyDown="dgMain_PreviewKeyDown"
                        AutoGenerateColumns="False" Margin="2" GotFocus="dgMain_GotFocus" LostFocus="dgMain_LostFocus">
                            <DataGrid.ContextMenu>
                                <ContextMenu >
                                    <MenuItem Header="Copy Row/s" IsEnabled="{Binding AllowRowCopy}"
                                Command="Copy">
                                    </MenuItem>
                                    <MenuItem Name="dgMainPasteRow" Header="Paste Row/s" IsEnabled="{Binding AllowRowPaste}" Click="dgMainPasteRow_Click">
                                    </MenuItem>
                                </ContextMenu>
                            </DataGrid.ContextMenu>
                            <DataGrid.Columns>
                                <DataGridTextColumn Binding="{Binding UdListItemID, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
                            Header="ID" Width="*">  
                            </DataGridTextColumn>
                                <DataGridTextColumn Binding="{Binding Description, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
                        Header="Description" Width="*"/>
                            </DataGrid.Columns>
                        </DataGrid>
                        <TextBox Style="{StaticResource BaseTextBox}" Name="ghost2" Grid.Column="4" 
                Height="0" Width="0" KeyboardNavigation.IsTabStop="False" Margin="128,259,82,259" />
                    </Grid>
                </TabItem>
            </TabControl>
    </Grid>
</UserControl>
